@mixin size($width, $height, $radius: null) {
  width: $width;
  height: $height;
  @if ($radius != "" and $radius != null) {
    border-radius: $radius;
  }
}

@mixin absolute(
  $top: null,
  $right: null,
  $bottom: null,
  $left: null,
  $index: null,
  $center: null
) {
  position: absolute;
  @if ($left != "" and $left != null) {
    left: $left;
  }
  @if ($right != "" and $right != null) {
    right: $right;
  }
  @if ($top != "" and $top != null) {
    top: $top;
  }
  @if ($bottom != "" and $bottom != null) {
    bottom: $bottom;
  }
  @if ($index != "" and $index != null) {
    z-index: $index;
  }
  @if ($center != null) {
    transform: translate(-50%, -50%);
  }
}

@mixin background(
  $src: null,
  $position: center,
  $repeat: no-repeat,
  $size: 100% 100%
) {
  background: url($src) $position $repeat;
  background-size: $size;
}

@mixin font(
  $size: 24rpx,
  $line: null,
  $color: #fff,
  $align: center,
  $weight: null,
  $style: null
) {
  font-size: $size;
  @if ($color != "" and $color != null) {
    color: $color;
  }
  @if ($align != "" and $align != null) {
    text-align: $align;
  }
  @if ($line != "" and $line != null) {
    line-height: $line;
  }
  @if ($weight != "" and $weight != null) {
    font-weight: $weight;
  }
  @if ($style != "" and $style != null) {
    font-style: $style;
  }
}

@mixin flex(
  $align: center,
  $justify: space-between,
  $direction: null,
  $wrap: null
) {
  display: flex;
  @if ($align != "" and $align != null) {
    align-items: $align;
  }
  @if ($justify != "" and $justify != null) {
    justify-content: $justify;
  }
  @if ($direction != "" and $direction != null) {
    flex-direction: $direction;
  }
  @if ($wrap != "" and $wrap != null) {
    flex-wrap: $wrap;
  }
}
